package com.hsgene.user.controller.organization;

import com.hsgene.common.util.result.ApiResult;
import com.hsgene.user.dto.orginazation.OrganizationDto;
import com.hsgene.user.service.OperationOrganizationService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * 组织管理Controller
 *
 * @author wangbing
 * @version 1.0, 2018/11/2
 */
@RestController
@RequestMapping("/v1.0/genetic/testing/organization")
public class OperationOrganizationController {

    @Resource
    private OperationOrganizationService operationOrganizationService;

    /**
     * 查询组织信息
     *
     * @param orgId   组织id
     * @param orgType 组织类型（position-职位,department-部门,company-公司）
     * @return 组织信息
     */
    @GetMapping("{org_id}")
    public ApiResult<OrganizationDto> findOrganization(
            @PathVariable("org_id") String orgId,
            @RequestParam(name = "orgType", defaultValue = "company") String orgType) {
        return operationOrganizationService.findOrganization(orgId, orgType);
    }
}
